/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.mlbs.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author mckd87
 */
@Entity
@Table(name = "geodb")
@NamedQueries({@NamedQuery(name = "Geodb.findByGeoId", query = "SELECT g FROM Geodb g WHERE g.geoId = :geoId"), @NamedQuery(name = "Geodb.findByName", query = "SELECT g FROM Geodb g WHERE g.name = :name"), @NamedQuery(name = "Geodb.findByValue", query = "SELECT g FROM Geodb g WHERE g.value = :value")})
public class Geodb implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Column(name = "geoId", nullable = false)
    private Integer geoId;
    @Column(name = "name")
    private String name;
    @Column(name = "value")
    private String value;
    @OneToMany(mappedBy = "geoId")
    private Collection<Preferences> preferencesCollection;

    public Geodb() {
    }

    public Geodb(Integer geoId) {
        this.geoId = geoId;
    }

    public Integer getGeoId() {
        return geoId;
    }

    public void setGeoId(Integer geoId) {
        this.geoId = geoId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public Collection<Preferences> getPreferencesCollection() {
        return preferencesCollection;
    }

    public void setPreferencesCollection(Collection<Preferences> preferencesCollection) {
        this.preferencesCollection = preferencesCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (geoId != null ? geoId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Geodb)) {
            return false;
        }
        Geodb other = (Geodb) object;
        if ((this.geoId == null && other.geoId != null) || (this.geoId != null && !this.geoId.equals(other.geoId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.mlbs.entity.Geodb[geoId=" + geoId + "]";
    }

}
